package com.csdj.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.csdj.pojo.IvIninvoice;
import com.csdj.pojo.IvOutinvoice;
import com.csdj.service.IvOutinvoiceService;
import com.csdj.mapper.IvOutinvoiceMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
* @author 叶涵
* @description 针对表【iv_outinvoice】的数据库操作Service实现
* @createDate 2023-08-24 15:13:39
*/
@Service
public class IvOutinvoiceServiceImpl extends ServiceImpl<IvOutinvoiceMapper, IvOutinvoice>
    implements IvOutinvoiceService{

    @Autowired
    private IvOutinvoiceMapper ivOutinvoiceMapper;

    @Override
    public int getCountByStartNoAndEndNo(int startNo , int endNo) {
        LambdaQueryWrapper<IvOutinvoice> lq=new LambdaQueryWrapper<>();
        lq.between(IvOutinvoice::getStartNo, startNo,endNo).or().between(IvOutinvoice::getEndNo,startNo,endNo).or().le(IvOutinvoice::getStartNo,startNo).ge(IvOutinvoice::getEndNo,endNo);
        Long aLong = count(lq);
        int i = aLong.intValue();
        return i ;
    }

    @Override
    public IvOutinvoice getOneByByStartNoAndEndNo(int startNo, int endNo) {
        LambdaQueryWrapper<IvOutinvoice> lq=new LambdaQueryWrapper<>();
        lq.between(IvOutinvoice::getStartNo,startNo,endNo).or().between(IvOutinvoice::getEndNo,startNo,endNo).or().le(IvOutinvoice::getStartNo,startNo).ge(IvOutinvoice::getEndNo,endNo);
        IvOutinvoice io = getOne(lq);
        return io;
    }

    @Override
    public Page<Map> listmap(Page<Map> page) {
        return ivOutinvoiceMapper.outInvoiceDetail(page);
    }

    @Override
    public Page<Map> listmapByEmp(Page<Map> page) {
        return ivOutinvoiceMapper.outInvoiceDetailByEmp(page);
    }

}




